home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_11 / dugger / mutex.h < prev   
C/C++ Source or Header  |  1995-09-05  |  671b  |  27 lines

  1. /*
  2.  
  3. Module Header : mutex.h
  4.  
  5. Function: Used at the top of nonreentrant functions, this limits
  6.           access to function to one thread at a time.
  7.  
  8. */
  9.  
  10. #define INCL_DOSSEMAPHORES
  11. #include <os2.h>
  12.  
  13. class mutex {
  14.    protected:
  15.       char     *sem_name;                 // name of semaphore
  16.       HMTX     handle;                    // semaphore handle
  17.       APIRET   rc;                        // API return code
  18.  
  19.    private:
  20.       mutex();                            // keeps user from using this
  21.  
  22.    public:
  23.       mutex( const char const* name );    // create sem_block strcture
  24.       ~mutex();                           // auto-destructor
  25.  
  26. };
  27.